package cn.wps.moffice.common.linkShare.extlibs; import android.app.Activity; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.text.TextUtils; import cn.wps.moffice.main.cloud.roaming.realname.RealNameIdentityActivity; import cn.wps.moffice.main.common.ServerParamsUtil; import cn.wps.moffice_eng.R; import defpackage.dxh; import defpackage.ebo; import java.io.File; import java.lang.ref.SoftReference; public class LinkShareCoreImpl implements dxg { private boolean epC; protected dxh.b epD; protected boolean epI; protected boolean epJ; protected boolean epK; private boolean epL; private long epM = -1; private long epN = -1; private long epO = -1; protected fnk epP; protected vwo epQ; protected String epR; protected Activity mContext; private String mFilePath; protected Handler mHandler; static class a extends Handler { private SoftReference<LinkShareCoreImpl> epX; a(LinkShareCoreImpl linkShareCoreImpl) { this.epX = new SoftReference<>(linkShareCoreImpl); } private static void b(LinkShareCoreImpl linkShareCoreImpl) { if (!linkShareCoreImpl.epJ) { linkShareCoreImpl.epJ = true; linkShareCoreImpl.epD.aOL(); } } public final void handleMessage(Message message) { boolean z = true; boolean z2 = false; LinkShareCoreImpl linkShareCoreImpl = this.epX.get(); if (linkShareCoreImpl != null) { switch (message.what) { case 1: linkShareCoreImpl.epD.onError(-1); return; case 2: b(linkShareCoreImpl); Object obj = message.obj; String str = null; if (obj != null) { str = String.valueOf(obj); } if (message.arg1 != 1) { z = false; } linkShareCoreImpl.v(str, z); return; case 3: b(linkShareCoreImpl); linkShareCoreImpl.mg(String.valueOf(message.obj)); return; case 4: b(linkShareCoreImpl); linkShareCoreImpl.aOQ(); return; case 5: linkShareCoreImpl.epD.onError(Integer.parseInt(String.valueOf(message.obj))); return; case 6: linkShareCoreImpl.epD.a(linkShareCoreImpl.epR, linkShareCoreImpl.epQ); return; case 7: linkShareCoreImpl.epJ = false; linkShareCoreImpl.epD.aOM(); return; case 8: linkShareCoreImpl.epD.onError(-5); return; case 9: linkShareCoreImpl.epD.onError(-10); return; case 10: b(linkShareCoreImpl); linkShareCoreImpl.aOR(); return; case 11: String valueOf = String.valueOf(message.obj); if ("依据国家法律法规要求,文档分享服务暂停使用".equals(valueOf) || "禁止创建分享链接".equals(valueOf)) { z2 = true; } if (z2) { linkShareCoreImpl.epD.mf(valueOf); return; } else { fpw.aK(linkShareCoreImpl.mContext, valueOf); return; } case 12: linkShareCoreImpl.epD.aOO(); return; case 13: linkShareCoreImpl.epD.aON(); return; default: return; } } } } public LinkShareCoreImpl(Activity activity, boolean z, dxh.b bVar) { this.epD = bVar; this.mContext = activity; this.epC = z; this.mHandler = new a(this); } protected static String a(vwo vwo) { if ("linkServicePause".equals(vwo.result)) { return "依据国家法律法规要求,文档分享服务暂停使用"; } if ("lightlinkCreateForbid".equals(vwo.result)) { return "禁止创建分享链接"; } return null; } private boolean aOS() { if (lwd.hu(this.mContext)) { return true; } this.epD.onError(-8); return false; } @Override // defpackage.dxg public final void a(fnk fnk, String str) { this.epP = fnk; this.mFilePath = str; } /* access modifiers changed from: protected */ public final boolean aOP() { String str = this.mFilePath; return (lul.Iv(str) && (new File(str).length() > 5242880 ? 1 : (new File(str).length() == 5242880 ? 0 : -1)) > 0) && !lwd.isWifiConnected(this.mContext); } public final void aOQ() { if (!aOS()) { this.mHandler.obtainMessage(7).sendToTarget(); } else if (!this.epD.aOK()) { this.mHandler.obtainMessage(7).sendToTarget(); } else if (cwz.io(this.mFilePath)) { this.mHandler.obtainMessage(5, -9).sendToTarget(); this.mHandler.obtainMessage(7).sendToTarget(); } else { ebo.b(lwv.IR(this.mFilePath), this.mFilePath, new ebo.b<String>() { /* class cn.wps.moffice.common.linkShare.extlibs.LinkShareCoreImpl.AnonymousClass3 */ /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */ @Override // defpackage.ebo.b public final /* synthetic */ void w(String str) { String str2 = str; if (!TextUtils.isEmpty(str2)) { LinkShareCoreImpl.this.q(0, str2); } else { fok.bBq().a(LinkShareCoreImpl.this.mFilePath, (String) null, true, false, true, (foh<String>) new foi<String>() { /* class cn.wps.moffice.common.linkShare.extlibs.LinkShareCoreImpl.AnonymousClass3.AnonymousClass1 */ @Override // defpackage.foi, defpackage.foh public final void onError(int i, String str) { if (!LinkShareCoreImpl.this.aOT()) { LinkShareCoreImpl.this.epK = false; if (i == -25) { LinkShareCoreImpl.this.epI = true; LinkShareCoreImpl.this.mHandler.obtainMessage(5, -3).sendToTarget(); LinkShareCoreImpl.this.mHandler.obtainMessage(7).sendToTarget(); return; } LinkShareCoreImpl.this.q(i, str); } } /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */ @Override // defpackage.foi, defpackage.foh public final /* synthetic */ void s(String str) { final String str2 = str; if (TextUtils.isEmpty(str2)) { LinkShareCoreImpl.this.q(0, null); } else { LinkShareCoreImpl.this.mHandler.postDelayed(new Runnable() { /* class cn.wps.moffice.common.linkShare.extlibs.LinkShareCoreImpl.AnonymousClass3.AnonymousClass1.AnonymousClass1 */ public final void run() { LinkShareCoreImpl.this.mHandler.obtainMessage(2, str2).sendToTarget(); } }, 600); } } }); } } }); } } public final void aOR() { if (!aOS()) { this.mHandler.obtainMessage(7).sendToTarget(); } else if (!this.epD.aOK()) { this.mHandler.obtainMessage(7).sendToTarget(); } else if (cwz.io(this.mFilePath)) { this.mHandler.obtainMessage(5, -9).sendToTarget(); this.mHandler.obtainMessage(7).sendToTarget(); } else { this.epK = true; this.epL = true; fok bBq = fok.bBq(); String str = this.mFilePath; AnonymousClass7 r2 = new foi<String>() { /* class cn.wps.moffice.common.linkShare.extlibs.LinkShareCoreImpl.AnonymousClass7 */ @Override // defpackage.foi, defpackage.foh public final void onError(int i, String str) { if (!LinkShareCoreImpl.this.aOT()) { LinkShareCoreImpl.this.epK = false; if (i == -25) { LinkShareCoreImpl.this.epI = true; LinkShareCoreImpl.this.mHandler.obtainMessage(5, -3).sendToTarget(); LinkShareCoreImpl.this.mHandler.obtainMessage(7).sendToTarget(); return; } LinkShareCoreImpl.this.q(i, str); } } /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */ @Override // defpackage.foi, defpackage.foh public final /* synthetic */ void s(String str) { final String str2 = str; if (LinkShareCoreImpl.this.aOT()) { return; } if (TextUtils.isEmpty(str2)) { LinkShareCoreImpl.this.q(0, null); } else { LinkShareCoreImpl.this.mHandler.postDelayed(new Runnable() { /* class cn.wps.moffice.common.linkShare.extlibs.LinkShareCoreImpl.AnonymousClass7.AnonymousClass1 */ public final void run() { LinkShareCoreImpl.this.mHandler.obtainMessage(2, str2).sendToTarget(); } }, 600); } } }; Bundle bundle = new Bundle(); bundle.putString("key_file_path", str); bBq.a(5, bundle, r2, String.class); } } /* access modifiers changed from: protected */ public final boolean aOT() { if (!this.epI) { return false; } this.mHandler.obtainMessage(7).sendToTarget(); return true; } @Override // defpackage.dxg public final void cancel() { if (this.epM != -1) { fok.bBq().T(this.epM); } if (this.epN != -1) { fok.bBq().T(this.epN); } this.epI = true; this.epJ = false; this.mHandler.obtainMessage(7).sendToTarget(); } @Override // defpackage.dxg public final void e(int i, Object obj) { switch (i) { case 0: this.epI = false; this.mHandler.obtainMessage(4).sendToTarget(); return; case 1: this.epI = false; this.mHandler.obtainMessage(2).sendToTarget(); return; case 2: this.epI = false; if (obj != null) { this.mHandler.obtainMessage(3, String.valueOf(obj)).sendToTarget(); return; } return; case 3: this.epI = false; this.mHandler.obtainMessage(10).sendToTarget(); return; default: return; } } @Override // defpackage.dxg public final void md(String str) { this.epL = false; this.epI = false; if (!ebo.arU()) { this.mHandler.obtainMessage(5, -6).sendToTarget(); this.mHandler.obtainMessage(7).sendToTarget(); return; } this.mFilePath = str; fok.bBq().d(this.mFilePath, new foi<vvn>() { /* class cn.wps.moffice.common.linkShare.extlibs.LinkShareCoreImpl.AnonymousClass1 */ @Override // defpackage.foi, defpackage.foh public final void onError(int i, String str) { super.onError(i, str); LinkShareCoreImpl.this.mHandler.obtainMessage(7).sendToTarget(); } /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */ @Override // defpackage.foi, defpackage.foh public final /* synthetic */ void s(vvn vvn) { boolean z; boolean z2; vvn vvn2 = vvn; if (!LinkShareCoreImpl.this.aOT()) { if (vvn2 != null) { z2 = vvn2.wCc; z = vvn2.wCd; } else { z = false; z2 = false; } if (!z2 && LinkShareCoreImpl.this.aOP()) { LinkShareCoreImpl.this.mHandler.obtainMessage(1).sendToTarget(); } else if (!z2) { LinkShareCoreImpl.this.mHandler.obtainMessage(4).sendToTarget(); } else if (!z) { LinkShareCoreImpl.this.mHandler.obtainMessage(2, 1, 0).sendToTarget(); } else if (LinkShareCoreImpl.this.aOP()) { LinkShareCoreImpl.this.mHandler.obtainMessage(9).sendToTarget(); } else { LinkShareCoreImpl.this.mHandler.obtainMessage(2).sendToTarget(); } } } }); } public final void mg(final String str) { if (!ServerParamsUtil.tH("wpsdrive_identity_switch") || this.epL || fza.bJK().getBoolean(foe.getKey(), false)) { mh(str); return; } AnonymousClass4 r0 = new Runnable() { /* class cn.wps.moffice.common.linkShare.extlibs.LinkShareCoreImpl.AnonymousClass4 */ public final void run() { LinkShareCoreImpl.this.mHandler.obtainMessage(13).sendToTarget(); LinkShareCoreImpl.this.mh(str); } }; AnonymousClass5 r1 = new Runnable() { /* class cn.wps.moffice.common.linkShare.extlibs.LinkShareCoreImpl.AnonymousClass5 */ public final void run() { LinkShareCoreImpl.this.mHandler.obtainMessage(7).sendToTarget(); } }; this.mHandler.obtainMessage(12).sendToTarget(); this.epO = fok.bBq().c(new foi<vsp>(this.mContext, r0, r1) { /* class defpackage.foe.AnonymousClass1 */ final /* synthetic */ Runnable gej; final /* synthetic */ Runnable gek; final /* synthetic */ Activity val$activity; { this.val$activity = r1; this.gej = r2; this.gek = r3; } @Override // defpackage.foi, defpackage.foh public final void onError(int i, String str) { lvg.a(this.val$activity, str, 1); if (this.gek != null) { fzc.bJM().y(this.gek); } } /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */ @Override // defpackage.foi, defpackage.foh public final /* synthetic */ void s(vsp vsp) { if (vsp.wzP == 0) { fzc.bJM().y(new Runnable() { /* class defpackage.foe.AnonymousClass1.AnonymousClass1 */ public final void run() { Activity activity = AnonymousClass1.this.val$activity; AnonymousClass1 r1 = new Runnable() { /* class defpackage.foe.AnonymousClass1.AnonymousClass1.AnonymousClass1 */ public final void run() { if (AnonymousClass1.this.gej != null) { fzc.bJM().y(AnonymousClass1.this.gej); } } }; czq czq = new czq(activity); czq.setMessage(R.string.public_realname_identity_tips); czq.setPositiveButton(R.string.public_realname_identity_go, activity.getResources().getColor(R.color.phone_public_dialog_highlight_color), new DialogInterface.OnClickListener(activity, r1) { /* class defpackage.foe.AnonymousClass2 */ final /* synthetic */ Runnable gen; final /* synthetic */ Activity val$activity; { this.val$activity = r1; this.gen = r2; } public final void onClick(DialogInterface dialogInterface, int i) { dwp.lV(huq.BL("share_link_identity_click")); Activity activity = this.val$activity; AnonymousClass1 r1 = new RealNameIdentityActivity.a() { /* class defpackage.foe.AnonymousClass2.AnonymousClass1 */ @Override // cn.wps.moffice.main.cloud.roaming.realname.RealNameIdentityActivity.a public final void bAY() { if (AnonymousClass2.this.gen != null) { dwp.lV(huq.BL("share_link_identity_success")); AnonymousClass2.this.gen.run(); } fok.bBq().c(new foi<vsp>() { /* class defpackage.foe.AnonymousClass2.AnonymousClass1.AnonymousClass1 */ /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */ @Override // defpackage.foi, defpackage.foh public final /* synthetic */ void s(vsp vsp) { if (vsp.wzP != 0) { foe.le(true); } } }); } }; activity.startActivity(new Intent(activity, RealNameIdentityActivity.class)); RealNameIdentityActivity.a(r1); } }); if ("on".equals(ServerParamsUtil.bP("wpsdrive_identity_switch", "skip_identity"))) { czq.setNegativeButton(R.string.public_realname_identity_notnow, new DialogInterface.OnClickListener(r1) { /* class defpackage.foe.AnonymousClass3 */ final /* synthetic */ Runnable gen; { this.gen = r1; } public final void onClick(DialogInterface dialogInterface, int i) { if (this.gen != null) { dwp.lV(huq.BL("share_link_identity_not_now")); this.gen.run(); } } }); } else { czq.setNegativeButton(R.string.public_cancel, new DialogInterface.OnClickListener() { /* class defpackage.foe.AnonymousClass4 */ public final void onClick(DialogInterface dialogInterface, int i) { } }); } dwp.lV(huq.BL("share_link_identity_show")); czq.show(); } }); return; } foe.le(true); if (this.gej != null) { fzc.bJM().y(this.gej); } } }); } /* access modifiers changed from: protected */ public final void mh(String str) { if (!aOT()) { fok bBq = fok.bBq(); cqn.arn(); boolean arr = cqn.arr(); AnonymousClass6 r2 = new foi<vwo>() { /* class cn.wps.moffice.common.linkShare.extlibs.LinkShareCoreImpl.AnonymousClass6 */ @Override // defpackage.foi, defpackage.foh public final void onError(int i, String str) { if (!LinkShareCoreImpl.this.aOT()) { if (-11 == i) { LinkShareCoreImpl.this.mHandler.obtainMessage(5, -2).sendToTarget(); } else { if (-3 != i) { if (-26 == i) { LinkShareCoreImpl.this.mHandler.obtainMessage(8).sendToTarget(); } else if (-14 != i || !lul.Iv(LinkShareCoreImpl.this.mFilePath)) { if (!TextUtils.isEmpty(str)) { LinkShareCoreImpl.this.mHandler.obtainMessage(11, str).sendToTarget(); } } else if (!LinkShareCoreImpl.this.epK) { LinkShareCoreImpl.this.mHandler.obtainMessage(10).sendToTarget(); return; } else { return; } } LinkShareCoreImpl.this.mHandler.obtainMessage(5, -7).sendToTarget(); } LinkShareCoreImpl.this.mHandler.obtainMessage(7).sendToTarget(); } } /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */ @Override // defpackage.foi, defpackage.foh public final /* synthetic */ void s(vwo vwo) { vwo vwo2 = vwo; if (!LinkShareCoreImpl.this.aOT()) { if (vwo2 == null) { LinkShareCoreImpl.this.q(0, null); } else if (vwo2.wCF != null) { String str = vwo2.wCF.gbm; LinkShareCoreImpl.this.epR = "https://pan.wps.cn/l/" + str; LinkShareCoreImpl.this.epQ = vwo2; LinkShareCoreImpl.this.mHandler.obtainMessage(6).sendToTarget(); } else { LinkShareCoreImpl.this.q(0, LinkShareCoreImpl.a(vwo2)); } LinkShareCoreImpl.this.mHandler.obtainMessage(7).sendToTarget(); } } }; Bundle bundle = new Bundle(); bundle.putString("key_fileid", str); bundle.putBoolean("key_is_reset", false); bundle.putString("key_include", null); bundle.putBoolean("key_iscompany", arr); this.epN = bBq.a(4, bundle, r2, vwo.class); } } /* access modifiers changed from: protected */ public final void q(int i, String str) { this.mHandler.obtainMessage(7).sendToTarget(); switch (i) { case -11: this.mHandler.obtainMessage(5, -2).sendToTarget(); return; default: if (!TextUtils.isEmpty(str)) { this.mHandler.obtainMessage(11, str).sendToTarget(); return; } else { this.mHandler.obtainMessage(5, -7).sendToTarget(); return; } } } public final void v(String str, boolean z) { if (!aOS()) { this.mHandler.obtainMessage(7).sendToTarget(); } else if (!z && !this.epD.aOK()) { this.mHandler.obtainMessage(7).sendToTarget(); } else if (z || !cwz.io(this.mFilePath)) { this.epM = fok.bBq().a(this.mFilePath, str, this.epC, new foi<String>() { /* class cn.wps.moffice.common.linkShare.extlibs.LinkShareCoreImpl.AnonymousClass2 */ @Override // defpackage.foi, defpackage.foh public final void onError(int i, String str) { if (!LinkShareCoreImpl.this.aOT()) { LinkShareCoreImpl.this.epK = false; if (i == -25) { LinkShareCoreImpl.this.epI = true; LinkShareCoreImpl.this.mHandler.obtainMessage(5, -3).sendToTarget(); LinkShareCoreImpl.this.mHandler.obtainMessage(7).sendToTarget(); return; } LinkShareCoreImpl.this.q(i, str); } } /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */ @Override // defpackage.foi, defpackage.foh public final /* synthetic */ void s(String str) { String str2 = str; if (LinkShareCoreImpl.this.aOT()) { return; } if (TextUtils.isEmpty(str2)) { LinkShareCoreImpl.this.q(0, null); return; } if ("roaming_file_path_upload_end".equals(str2)) { if (LinkShareCoreImpl.this.epP == null) { LinkShareCoreImpl.this.mHandler.obtainMessage(5, -4).sendToTarget(); LinkShareCoreImpl.this.mHandler.obtainMessage(7).sendToTarget(); return; } str2 = LinkShareCoreImpl.this.epP.fileId; } LinkShareCoreImpl.this.mHandler.obtainMessage(3, str2).sendToTarget(); } }); } else { this.mHandler.obtainMessage(5, -9).sendToTarget(); this.mHandler.obtainMessage(7).sendToTarget(); } } }